package com.appwoo.txtws.component;

import android.content.Context;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import java.util.Iterator;
import java.util.List;

public class KeyboardUtil
{
  private View act;
  private Context ctx;
  private EditText ed;
  public boolean isnun = false;
  public boolean isupper = false;
  private Keyboard k1;
  private Keyboard k2;
  private KeyboardView keyboardView;
  private KeyboardView.OnKeyboardActionListener listener = new KeyboardView.OnKeyboardActionListener()
  {
    public void onKey(int paramAnonymousInt, int[] paramAnonymousArrayOfInt)
    {
      Editable localEditable = KeyboardUtil.this.ed.getText();
      int i = KeyboardUtil.this.ed.getSelectionStart();
      if (paramAnonymousInt == -3)
        KeyboardUtil.this.hideKeyboard();
      do
      {
        do
        {
          do
          {
            return;
            if (paramAnonymousInt != -5)
              break;
          }
          while ((localEditable == null) || (localEditable.length() <= 0) || (i <= 0));
          localEditable.delete(i - 1, i);
          return;
          if (paramAnonymousInt == -1)
          {
            KeyboardUtil.this.changeKey();
            KeyboardUtil.this.keyboardView.setKeyboard(KeyboardUtil.this.k1);
            return;
          }
          if (paramAnonymousInt == -2)
          {
            if (KeyboardUtil.this.isnun)
            {
              KeyboardUtil.this.isnun = false;
              KeyboardUtil.this.keyboardView.setKeyboard(KeyboardUtil.this.k1);
              return;
            }
            KeyboardUtil.this.isnun = true;
            KeyboardUtil.this.keyboardView.setKeyboard(KeyboardUtil.this.k2);
            return;
          }
          if (paramAnonymousInt != 57419)
            break;
        }
        while (i <= 0);
        KeyboardUtil.this.ed.setSelection(i - 1);
        return;
        if (paramAnonymousInt != 57421)
          break;
      }
      while (i >= KeyboardUtil.this.ed.length());
      KeyboardUtil.this.ed.setSelection(i + 1);
      return;
      localEditable.insert(i, Character.toString((char)paramAnonymousInt));
    }

    public void onPress(int paramAnonymousInt)
    {
    }

    public void onRelease(int paramAnonymousInt)
    {
    }

    public void onText(CharSequence paramAnonymousCharSequence)
    {
    }

    public void swipeDown()
    {
    }

    public void swipeLeft()
    {
    }

    public void swipeRight()
    {
    }

    public void swipeUp()
    {
    }
  };
  private RelativeLayout sln_rel_bottominput;
  private View v;

  public KeyboardUtil(View paramView, Context paramContext, EditText paramEditText)
  {
    this.act = paramView;
    this.ctx = paramContext;
    this.ed = paramEditText;
    this.k1 = new Keyboard(paramContext, 2131034121);
    this.k2 = new Keyboard(paramContext, 2131034122);
    this.keyboardView = ((KeyboardView)paramView.findViewById(2131493402));
    this.keyboardView.setKeyboard(this.k1);
    this.keyboardView.setEnabled(true);
    this.keyboardView.setPreviewEnabled(true);
    this.keyboardView.setOnKeyboardActionListener(this.listener);
  }

  private void changeKey()
  {
    List localList = this.k1.getKeys();
    Iterator localIterator2;
    if (this.isupper)
    {
      this.isupper = false;
      localIterator2 = localList.iterator();
      if (localIterator2.hasNext());
    }
    while (true)
    {
      return;
      Keyboard.Key localKey2 = (Keyboard.Key)localIterator2.next();
      if ((localKey2.label == null) || (!isword(localKey2.label.toString())))
        break;
      localKey2.label = localKey2.label.toString().toLowerCase();
      localKey2.codes[0] = (32 + localKey2.codes[0]);
      break;
      this.isupper = true;
      Iterator localIterator1 = localList.iterator();
      while (localIterator1.hasNext())
      {
        Keyboard.Key localKey1 = (Keyboard.Key)localIterator1.next();
        if ((localKey1.label != null) && (isword(localKey1.label.toString())))
        {
          localKey1.label = localKey1.label.toString().toUpperCase();
          localKey1.codes[0] = (-32 + localKey1.codes[0]);
        }
      }
    }
  }

  private boolean isword(String paramString)
  {
    return "abcdefghijklmnopqrstuvwxyz".indexOf(paramString.toLowerCase()) > -1;
  }

  public void hideKeyboard()
  {
    if (this.keyboardView.getVisibility() == 0)
      this.keyboardView.setVisibility(8);
  }

  public void showKeyboard()
  {
    int i = this.keyboardView.getVisibility();
    if ((i == 8) || (i == 4))
      this.keyboardView.setVisibility(0);
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.component.KeyboardUtil
 * JD-Core Version:    0.6.2
 */